<template lang="html">
  <div class="all-cart">
    <!--购物车空-->
    <div class="no-cart" v-if='!cart'>
        <img :src="img_url+'/cart/no.png'" alt="" class="no-cart-icon">
        <a href="{:U('Goods/goods_list')}" class="to-market">去逛逛</a>
    </div>
    <!--有购物车-->
    <form action="{:U('cart/to_pay')}" method="post" id="test_form">
    <div class="cart-item" v-for='item in cart'>
        <input type="hidden" name="goods_num[]" value="" class="hidden">
        <input type="hidden" name="goods_spec_id[]" value="" class="hidden1">
        <div class="radio">
            <input type="checkbox" class="checkout" name="goods_id[]" value="{$vo.goods_id}" autocomplete="off" id="goods{$vo.goods_id}{$vo.goods_spec_weight}"/>
            <label for="goods{$vo.goods_id}{$vo.goods_spec_weight}"></label>
        </div>
        <img src="{$vo.original_img}" alt="" class="bigImg">
        <div class="right">
            <div class="right-top">
                <div class="right-top-left">{$vo.goods_name}</div>
                <div class="right-top-right">¥<em class="the-shop-price">{$vo.sum_price}</em></div>
            </div>
            <div class="right-bottom clearfix">
                <div class="right-bottom-left">
                    <div class="item-row">
                        <div class="item-row-left">
                            <p>单价：</p>
                            <p>规格：</p>
                        </div>
                        <div class="item-row-right">
                            <span class="shop-price"><em class="shop">{$vo.spec_shop_price}</em>元</span>
                            <span>{$vo.goods_spec_weight}g</span>
                        </div>
                    </div><div class="item-row">
                    <div class="item-row-left">
                        <input type="button" class="sub" value="-">
                        <input type="button" class="value" value="{$vo.goods_num}" num=""  data-spec="{$vo.goods_spec_id}">
                        <input type="button" class="add" value="+">
                    </div>
                    <div class="item-row-right">
                    </div>
                </div>

                </div>
                <div class="right-bottom-right" onclick="sc_cart('{$vo.id}')">
                    <img src="__PUBLIC__/kjin/img/cart/sc.png" alt="">
                </div>
            </div>
        </div>
    </div>
    </form>
    <div class="total">
        <div class="total-left">
            <input type="checkbox" class="reverse" autocomplete="off" id="reverse"/>
            <label for="reverse" class="reverse-label">全选</label>
        </div>

        <p class="total-middle" >
            结算
        </p>

        <div class="total-right">
            <p>合计:￥<em class="total-pricece">0</em></p>
            <span>运费到付</span>
        </div>
    </div>
    <div class="main-text">
        <h3>还未登录</h3>
        <h4>请先登录~</h4>
        <a href="{:U('Mobile/user/login')}">去登录</a>
    </div>
  </div>
</template>

<script>
import global from '../global.vue'
import $ from 'jquery'

export default {
  data(){
    return{
      cart:[],
      img_url : global.img_url,
      base_url : global.base_url
    }
  },
  mounted:function(){
    var that = this;
    $.ajax({
      url:'https://m.kjinwang.com/api/Cart/index',
      type:'GET',
      dataType:'JSON',
      data:{user_token:'15aaf033f1cf3c596e0a92a5706e6b95'},
      success:function(res){
        console.log(res);
        that.cart = res.data
        // that.user = JSON.parse(res)
      },
      fail:function(err){

      }
    })
  },
  methods:{

  }
}
</script>

<style src='../assets/css/carts.css'>
</style>
